--[[ 编码: WMS-38-02 名称: 搬运指令-修改前 作者:HAN 日期:2025-1-29 级别:固定 (说明本段代码在项目中不太会变化) 函数: BeforeDataObjModify 功能: 1)对一些数值类型的属性生成这些类型的解析属性 更改记录: --]] wms_base = require( "wms_base" ) function BeforeDataObjModify ( strLuaDEID ) local nRet, strRetInfo local task nRet, task = m3.GetCurEditDataObj( strLuaDEID ) if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), "获取当前编辑属性失败! "..task ) end local state = lua.StrToNumber( obj_attrs[1].value ) -- 状态 local schedule = lua.StrToNumber( obj_attrs[2].value ) -- 调度系统类型 local task_type = lua.StrToNumber( obj_attrs[3].value ) -- 任务类型 local state = lua.Get_NumAttrValue( task.bs_state ) -- 状态 local schedule = lua.Get_NumAttrValue( task.schedule_type ) -- 调度系统类型 local task_type = lua.Get_NumAttrValue( task.type ) -- 任务类型 local end_loc_code = lua.Get_StrAttrValue( task.end_loc_code ) local start_loc_code = lua.Get_StrAttrValue( task.start_loc_code ) local start_lane = 0 local end_lane = 0 local loc -- 获取货位的巷道值 if ( end_loc_code ~= '' ) then nRet, loc = wms_wh.GetLocInfo( end_loc_code ) if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), "货位'"..end_loc_code.."'不存在!" ) end end_lane = loc.aisle end if ( start_loc_code ~= '' ) then nRet, loc = wms_wh.GetLocInfo( start_loc_code ) if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), "货位'"..start_loc_code.."'不存在!" ) end start_lane = loc.aisle end -- 根据字典获取 N_B_STATE 的显示名称 local str_b_satte = wms_base.GetDictItemName( strLuaDEID, "WMS_TaskState", state ) -- 取调度系统类型信息 local str_schedule_type = wms_base.GetDictItemName( strLuaDEID, "WMS_ScheduleSystemType", schedule ) -- 取任务类型信息 local str_task_type = wms_base.GetDictItemName( strLuaDEID, "WMS_TaskType", task_type ) -- 设置信息 local attr_value = { { attr = "S_B_STATE", value = str_b_state }, { attr = "S_SCHEDULE_TYPE", value = str_schedule_type }, { attr = "S_TYPE", value = str_task_type }, { attr = "N_START_AISLE", value = start_lane }, { attr = "N_END_AISLE", value = end_lane } } nRet, strRetInfo = mobox.setCurEditDataObjAttr( strLuaDEID, lua.table2str(attr_value) ) if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), "设置【任务】信息失败! "..strRetInfo ) end end